const workSpace = {
  state: { 
    workSpace:{ 
      locationId:'',
      locationName:'',
      shopId:'',
      shopName:'',
      deptid:'',
      deptName:'',
      branchId:'',
      branchName:'',
    },
     
  },

  mutations: {
     
    SET_WORK_SPACE:(state,workSpace)=>{
      state.workSpace = workSpace
    },
     
  },

  actions: {
     setWorkSpace({ commit }, workSpace){ 
      return new Promise((resolve, reject) => {
        commit("SET_WORK_SPACE",workSpace)
        localStorage.setItem("workSpace",JSON.stringify(workSpace));
        resolve(workSpace)
      })
     }
 
  }
} 
var wokSpaceLocal=localStorage.getItem("workSpace");
if(wokSpaceLocal){
   
  workSpace.state.workSpace=Object.assign( workSpace.state.workSpace,JSON.parse(wokSpaceLocal))
}
export default workSpace